<template>
  <div>
    <h1>List</h1>
    <button @click="sendData">向父传递数据</button>
  </div>
</template>

<script>
export default {
  name: "List",
  data() {
    return {
      list: [
        { name: "laoli", age: 19 },
        { name: "laozhang", age: 19 },
        { name: "laowang", age: 24 },
      ],
    };
  },
  methods: {
    sendData() {
        // this.$emit触发当前实例上的自定义事件，附件参数会传递给事件回调
      this.$emit("atguigu", this.list);
    },
  },
};
</script>

<style>
</style>